#pragma once
#include <iostream>
#include <string>
#include <functional>
#include <pthread.h>
#include <ctime>

// using Task = std::function<void()>;

// void DownLoad()
// {
//     std::cout << "this is a download task..." << std::endl;
// }


class Task
{
public:
    Task(){}
    Task(int a, int b)
        :_a(a), _b(b), _result(0)
    {}
    void Excute()
    {
        _result = _a + _b;
    }
    void operator()()
    {
        Excute();
    }
    std::string DebugToString()
    {
        return std::to_string(_a) + "+" + std::to_string(_b) + "=?";
    }
    std::string ResultToString()
    {
        return std::to_string(_a) + "+" + std::to_string(_b) + "=" + std::to_string(_result);
    }
    ~Task(){}
private:
    int _a;
    int _b;
    int _result;
};

Task GetATask()
{
    int a = rand() % 10 + 1;
    usleep(1234);
    int b = rand() % 20 + 1;
    return Task(a, b);
}